/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: WHY
 * Date: 2022-06-12
 * Time: 17:16

 **/

    public class Date {
    public int year;
    private int month;
    public int day;
    public  Date(){
        /*this.year=2022;
        this.month=6;
        this.day=12;
        this.printDate();
        System.out.println("不带参数的构造方法");*/
        this(1998,5,8);//代表调用另一个带有三个参数的成员方法
    }
    public  void  setMonth(int month){
        this.month=month;
    }
    public int getMonth(){
        return month;
    }


    public Date(int year, int month, int day) {
        this.year =year;
        this.month =month;
        this.day =day;
        System.out.println("带三个参数的构造方法");
    }

    public void printDate() {
        System.out.println(year + "-" + month + "-" + day);
    }

    public static void main(String[] args) {
        Date   date=new  Date();
        date.setMonth(5);
        System.out.println("获取当前的月份"+date.getMonth());
        date.printDate();

    }

    /*public static void main1(String[] args) {
        Date date1 = new Date();
        date1.printDate();
        Date date2 = new Date(1998,5,6);
        date2.printDate();

    }*/
}